"""
应用配置信息
"""
from os import path
from pydantic import BaseSettings, HttpUrl


class Settings(BaseSettings):
    app_dir: str = path.dirname(path.dirname(__file__))  # 应用程序打包后app的当前目录:app/
    work_dir: str = path.abspath('./')  # app当前目录:app/
    assets_dir: str = path.join(app_dir, 'assets')
    example_dir: str = path.join(work_dir, 'example')
    example_inv_dir: str = path.join(work_dir, 'example', 'invoice')
    example_fin_dir: str = path.join(work_dir, 'example', 'financial')
    db_path: str = path.join(work_dir, 'app.db')
    resource_path: str = path.join(work_dir, 'resource')
    chrome_path: str = path.join(resource_path, 'chrome-win32', 'chrome.exe')
    screen_capture_dir: str = path.join(work_dir, '查验结果截图')
    # ui
    app_title: str = '高效办公助手'
    app_version: str = 'OAA-v1.2.1.20211123'

    # web api
    base_url: HttpUrl = 'http://82.157.113.214:5000/api/v1'
    login_url: HttpUrl = base_url + '/user/login'
    register_url: HttpUrl = base_url + '/user/register'

    alipay_order_create_url: HttpUrl = base_url + '/pay/alipay/order/create'
    alipay_order_status_url: HttpUrl = base_url + '/pay/alipay/order/status'
    alipay_order_cancel_url: HttpUrl = base_url + '/pay/alipay/order/cancel'
    user_info_url: HttpUrl = base_url + '/user/info'
    user_account_url: HttpUrl = base_url + '/user/account'
    app_version_url: HttpUrl = base_url + '/deskapp/version/latest'
    feedback_url: HttpUrl = base_url + '/user/feedback'
    consume_inv_num_url: HttpUrl = base_url + '/user/use-inv-num'
    consume_tab_num_url: HttpUrl = base_url + '/user/use-tab-num'
    
    inv_parse_url: HttpUrl = base_url + '/invoice/info/base'


settings = Settings()
